<?xml version="1.0" encoding="windows-1250"?>
<gxsl:stylesheet xmlns:gxsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/TransformAlias" xml:space="default">
  <gxsl:namespace-alias stylesheet-prefix="xsl" result-prefix="gxsl"/>
  <gxsl:output method="xml" encoding="windows-1250" cdata-section-elements="gxsl:comment" indent="yes"/>
  
  <gxsl:param name="cvincludepage"/>
  <gxsl:param name="cvinclude" select="$cvincludepage/.."/>
  <gxsl:param name="lang">cs</gxsl:param>
  
  <gxsl:include href="genflapnavlabel.xsl"/>  
  
  <gxsl:template match="/">
    <xsl:stylesheet version="1.0">
      <xsl:output method="html" indent="no" encoding="windows-1250"/>
      <gxsl:apply-templates select="$cvinclude"/>
    </xsl:stylesheet>
  </gxsl:template>

  <gxsl:template match="CVInclude">

    <gxsl:variable name="dict" select="document('dictionary.xml')/Translation"/>

      <xsl:template match="DPOutput">

        <p><font size="-1"><b>

        <gxsl:choose>
          <gxsl:when test="name(..)!='CView'">
            <a href="?dp=list{ancestor::CView/CVInclude/@id_cvinclude}"><gxsl:choose><gxsl:when test="ancestor::CView/CVInclude/CVITitles/CVITitle[@id_cttype='flaptitle']/Title and ancestor::CView/CVInclude/CVITitles/CVITitle[@id_cttype='flaptitle']/Title!=''"><gxsl:value-of select="ancestor::CView/CVInclude/CVITitles/CVITitle[@id_cttype='flaptitle']/Title"/></gxsl:when><gxsl:otherwise><gxsl:value-of select="Concept/@name"/></gxsl:otherwise></gxsl:choose></a> - 
          </gxsl:when>
          <gxsl:otherwise>
            <a href="?dp=list{@id_cvinclude}"><gxsl:choose><gxsl:when test="CVITitles/CVITitle[@id_cttype='flaptitle']/Title and CVITitles/CVITitle[@id_cttype='flaptitle']/Title!=''"><gxsl:value-of select="CVITitles/CVITitle[@id_cttype='flaptitle']/Title"/></gxsl:when><gxsl:otherwise><gxsl:value-of select="Concept/@name"/></gxsl:otherwise></gxsl:choose></a> -
          </gxsl:otherwise>
        </gxsl:choose>                    

        <gxsl:variable name="thiscvi" select="."/>
        
        <gxsl:for-each select="ancestor-or-self::CVInclude[name(..)!='CView']">
          <gxsl:variable name="currcvi" select="../../../."/>
          <a>
            <xsl:attribute name="href">
              <gxsl:choose>
                <gxsl:when test="$thiscvi/@required='1' or $thiscvi/@jumpstodetail='1'">?dp=edit<gxsl:value-of select="$currcvi/@id_cvinclude"/></gxsl:when>
                <!--<gxsl:when test="../Step[position()+1]">?dp=list<gxsl:value-of select="../Step[position()+1]/@id_cvinclude"/></gxsl:when>-->
                <gxsl:when test="$thiscvi/@id_cvinclude!=current()/@id_cvinclude">?dp=list<gxsl:value-of select="current()/@id_cvinclude"/></gxsl:when>
                <gxsl:otherwise>?dp=list<gxsl:value-of select="$thiscvi/@id_cvinclude"/></gxsl:otherwise>
              </gxsl:choose>                    
              <gxsl:for-each select="$currcvi/CVIProperties/CVIProperty[PropGroup/@basegroup='true' and @key='1']">&amp;<gxsl:value-of select="@name"/>=<xsl:value-of select="DPNavig/{../../@conceptcoll}/{../../@concept}/@{@lowname}"/></gxsl:for-each>
              <gxsl:for-each select="ancestor::CVInclude/../CVIRBindings/CVIRBinding">
                <gxsl:variable name="xp2" select="@p2"/>
                <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=$xp2])">               
                  <xsl:text>&amp;</xsl:text><gxsl:value-of select="@p2"/><xsl:text>=</xsl:text><xsl:value-of select="DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/>
                </gxsl:if>                             
              </gxsl:for-each>
              <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                  <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                </gxsl:if>
              </gxsl:for-each>                          
            </xsl:attribute>
                            
            <gxsl:call-template name="writelabel">
              <gxsl:with-param name="dp">DPNavig</gxsl:with-param>
              <gxsl:with-param name="cvi" select="$currcvi"/>
              <gxsl:with-param name="lengthlimit" select="23"/>                        
            </gxsl:call-template>
      
          </a> -
        </gxsl:for-each>


        <gxsl:choose>
          <gxsl:when test="CVITitles/CVITitle[@id_cttype='maintitle']/Title and CVITitles/CVITitle[@id_cttype='maintitle']/Title!=''">
            <gxsl:value-of select="CVITitles/CVITitle[@id_cttype='maintitle']/Title"/>
          </gxsl:when>
          <gxsl:otherwise>
            <gxsl:value-of select="Concept/@name"/>
          </gxsl:otherwise>
        </gxsl:choose> 

        </b></font></p>

        <table cellpadding="0" cellspacing="0" border="0">
          <tr>
            <td>

              <table cellpadding="2" cellspacing="0" border="0">
                <tr>
                  <td class="flap_active">
      
                    <a class="flap_active">
                      <xsl:attribute name="href">?dp=create<gxsl:value-of select="@id_cvinclude"/><gxsl:for-each select="Keys/Binding">&amp;<gxsl:value-of select="@property"/>=<xsl:value-of select="DPEdit/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/></gxsl:for-each>
                        <gxsl:for-each select="ancestor-or-self::CVInclude/../CVIRBindings/CVIRBinding"><gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">&amp;<gxsl:value-of select="@p1"/>=<xsl:value-of select="DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/></gxsl:if></gxsl:for-each>
                        <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
                          <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                          <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                            <gxsl:text>&amp;</gxsl:text><gxsl:value-of select="@property"/>=<xsl:value-of select="DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                          </gxsl:if>
                        </gxsl:for-each>
                      </xsl:attribute>

                      <gxsl:choose>
                        <gxsl:when test="CVITitles/CVITitle[@id_cttype='maintitle']/Title and CVITitles/CVITitle[@id_cttype='maintitle']/Title!=''">
                          <gxsl:value-of select="CVITitles/CVITitle[@id_cttype='maintitle']/Title"/>
                        </gxsl:when>
                        <gxsl:otherwise>
                          <gxsl:value-of select="Concept/@name"/>
                        </gxsl:otherwise>
                      </gxsl:choose>  

                    </a>
                  </td>
                  
                  <gxsl:for-each select="CVIRels/CVIRel/CVInclude[@virtual='0' and (not(@hasflap) or @hasflap!='0') and not(@path='../..')]">
                    <td><img src="{{/DPOutput/@cpath}}/sta/{{/DPOutput/@repository}}/img/blank.gif" width="1" height="1"/></td>
                    <td class="flap_inactive">
                      <span class="flap_inactive"><gxsl:choose><gxsl:when test="CVITitles/CVITitle[@id_cttype='flaptitle']/Title and CVITitles/CVITitle[@id_cttype='flaptitle']/Title!=''"><gxsl:value-of select="CVITitles/CVITitle[@id_cttype='flaptitle']/Title"/></gxsl:when><gxsl:otherwise><gxsl:value-of select="Concept/@name"/></gxsl:otherwise></gxsl:choose></span>
                    </td>
                  </gxsl:for-each>

                  <gxsl:for-each select="CVIRels/CVIRel/CVInclude[@path='../..']">
                    <gxsl:for-each select="../../../../../../CVIRels/CVIRel/CVInclude[@virtual='0' and (not(@hasflap) or @hasflap!='0') and not(@path='../..')]">
                      <td><img src="{{/DPOutput/@cpath}}/sta/{{/DPOutput/@repository}}/img/blank.gif" width="1" height="1"/></td>
                      <td class="flap_inactive">
                        <span class="flap_inactive"><gxsl:choose><gxsl:when test="CVITitles/CVITitle[@id_cttype='flaptitle']/Title and CVITitles/CVITitle[@id_cttype='flaptitle']/Title!=''"><gxsl:value-of select="CVITitles/CVITitle[@id_cttype='flaptitle']/Title"/></gxsl:when><gxsl:otherwise><gxsl:value-of select="Concept/@name"/></gxsl:otherwise></gxsl:choose></span>
                      </td>
                    </gxsl:for-each>
                  </gxsl:for-each>

                </tr>
              </table>
            </td>
          </tr>

          <tr>
            <td class="flap_detail">
    
              <table cellpadding="12" cellspacing="0" border="0" width="100%">
                <tr>
                  <td class="text">
    
                    <xsl:apply-templates/>                            
    
                  </td>
                </tr>
              </table>
    
            </td>
          </tr>
        </table>

      </xsl:template>

      <xsl:template name="title"><gxsl:value-of select="ancestor::CView/CVTitles/CVTitle/Title"/></xsl:template>
  
  </gxsl:template>
        
</gxsl:stylesheet>
